package cn.tedu.plus.bigint_bigdecimal;

import java.math.BigDecimal;

public class BigDecimalDemo {
    public static void main(String[] args) {
        double d1 = 0.1;
        double d2 = 0.2;

        System.out.println(d1 + d2);

        String s1 = "0.1";
        String s2 = "0.2";

//        BigDecimal number1 = new BigDecimal(s1);
        BigDecimal number1 = BigDecimal.valueOf(d1);
//        BigDecimal number2 = new BigDecimal(s2);
        BigDecimal number2 = BigDecimal.valueOf(d2);

        System.out.println(number1.add(number2));

        number1.divide(number2,BigDecimal.ROUND_CEILING);
    }
}
